We have used time-resolved optical spectroscopy to study the refolding of reduced cytochrome c in guanidine hydrochloride solutions initiated by the photodissociation of bound CO. Several spectral changes are observed at times ranging from microseconds to tens of milliseconds, which are attributed to both CO rebinding and the transient binding of non-native heme ligands from among the amino acid sidechains of the unfolded protein. We have analyzed the measured spectra using a simple kinetic model in which the two histidine and two methionine sidechains of the protein may compete with CO to bind to the heme. Fits with this model are consistent with the methionines binding more rapidly than the histidines, with however very little transient formation of folded protein with the native methionine 80 bound. We have also simulated the photodissociation and subsequent rebinding of nitric oxide ligands to myoglobin using molecular dynamics. Most of the dissociated ligands remain within a pocket close to the heme before rebinding within a few picoseconds. The simulated rate of rebinding at the heme is considerably faster than the experimentally determined rate, but the rate of ligand escape from the heme pocket estimated from the simulations using a simple kinetic scheme is comparable to the corresponding estimate from the experiments.